package com.briup.oagg.dataset.bean.ext;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import lombok.Data;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Optional;

/**
 * 圈闭信息扩展信息
 *
 * @author briup
 */
@Data
public class TreeInfo {
    //地质编号
    private String value;
    //地质名称
    private String label;
    //子地质的集合
    private List<TreeInfo> children;

    /**
     * 解决json返回空集合属性值转化为[]问题
     * @return 长度为0,返回null
     */
    @JsonGetter("children")
    public List<TreeInfo> getEmptyList() {
        return CollectionUtils.isEmpty(children) ? null : children;
    }
}
